package com.example.springdemo;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;

@RestController
@RequestMapping("/wms/web")
public class OrderReviewController {

    private static final Logger log = LoggerFactory.getLogger(OrderReviewController.class);

    @CrossOrigin
    @PostMapping(value = "/register/get_inspect_notic_list")
    public Object get_login_key2(Object request) {
        // 指定资源路径（相对于classpath根目录）
        try (InputStream inputStream = getClass().getClassLoader().getResourceAsStream("get_inspect_notic_list.json")) {
            if (inputStream == null) {
                return "File not found.";
            }
            // 将输入流转换为字符串
            return new String(inputStream.readAllBytes(), StandardCharsets.UTF_8);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    @CrossOrigin
    @PostMapping(value = "/zp/register/get_inspect_notic_list")
    public Object zp_get_login_key2(Object request) {
        // 指定资源路径（相对于classpath根目录）
        try (InputStream inputStream = getClass().getClassLoader().getResourceAsStream("get_inspect_notic_list.json")) {
            if (inputStream == null) {
                return "File not found.";
            }
            // 将输入流转换为字符串
            return new String(inputStream.readAllBytes(), StandardCharsets.UTF_8);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    @CrossOrigin
    @GetMapping(value = "/register/get_inspect_notice_info/{id}")
    public Object get_inspect_notice_info_id(@PathVariable String id) {
        // 指定资源路径（相对于classpath根目录）
        String fileName = "get_inspect_notice_info_id.json";
        try (InputStream inputStream = getClass().getClassLoader().getResourceAsStream(fileName)) {
            if (inputStream == null) {
                return "File not found.";
            }
            // 将输入流转换为字符串
            return new String(inputStream.readAllBytes(), StandardCharsets.UTF_8);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    @CrossOrigin
    @GetMapping(value = "/zp/register/get_inspect_notice_info/{id}")
    public Object zp_get_inspect_notice_info_id(@PathVariable String id) {
        // 指定资源路径（相对于classpath根目录）
        String fileName = "get_inspect_notice_info_id.json";
        try (InputStream inputStream = getClass().getClassLoader().getResourceAsStream(fileName)) {
            if (inputStream == null) {
                return "File not found.";
            }
            // 将输入流转换为字符串
            return new String(inputStream.readAllBytes(), StandardCharsets.UTF_8);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    @CrossOrigin
    @GetMapping(value = "/my_wf/register/get_inspect_notice_info/{id}")
    public Object get_inspect_my_wf_notice_info_id(@PathVariable String id) {
        // 指定资源路径（相对于classpath根目录）
        String fileName = "get_inspect_notice_info_id.json";
        try (InputStream inputStream = getClass().getClassLoader().getResourceAsStream(fileName)) {
            if (inputStream == null) {
                return "File not found.";
            }
            // 将输入流转换为字符串
            return new String(inputStream.readAllBytes(), StandardCharsets.UTF_8);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }


    @CrossOrigin
    @PostMapping(value = "/inspect/get_demand_dept_list")
    public Object get_task_and_platform_list(Object request) {
        // 未实现
        // 指定资源路径（相对于classpath根目录）
        try (InputStream inputStream = getClass().getClassLoader().getResourceAsStream("get_demand_dept_list.json")) {
            if (inputStream == null) {
                return "File not found.";
            }
            // 将输入流转换为字符串
            return new String(inputStream.readAllBytes(), StandardCharsets.UTF_8);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    @CrossOrigin
    @PostMapping(value = "/register/get_purchase_head_list")
    public Object getList() {
        // 指定资源路径（相对于classpath根目录）
        try (InputStream inputStream = getClass().getClassLoader().getResourceAsStream("get_purchase_head_list.json")) {
            if (inputStream == null) {
                return "File not found.";
            }
            // 将输入流转换为字符串
            return new String(inputStream.readAllBytes(), StandardCharsets.UTF_8);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    @CrossOrigin
    @PostMapping(value = "/register/get_purchase_item_list")
    public Object get_purchase_item_list() {
        // 指定资源路径（相对于classpath根目录）
        try (InputStream inputStream = getClass().getClassLoader().getResourceAsStream("get_purchase_item_list.json")) {
            if (inputStream == null) {
                return "File not found.";
            }
            // 将输入流转换为字符串
            return new String(inputStream.readAllBytes(), StandardCharsets.UTF_8);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    @CrossOrigin
    @PostMapping(value = "/auth/get_real_wh_list")
    public Object get_real_wh_list() {
        // 指定资源路径（相对于classpath根目录）
        try (InputStream inputStream = getClass().getClassLoader().getResourceAsStream("get_real_wh_list.json")) {
            if (inputStream == null) {
                return "File not found.";
            }
            // 将输入流转换为字符串
            return new String(inputStream.readAllBytes(), StandardCharsets.UTF_8);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    @CrossOrigin
    @GetMapping(value = "/inspect/check")
    public Object inspect_check() {
        // 指定资源路径（相对于classpath根目录）
        try (InputStream inputStream = getClass().getClassLoader().getResourceAsStream("inspect_check.json")) {
            if (inputStream == null) {
                return "File not found.";
            }
            // 将输入流转换为字符串
            return new String(inputStream.readAllBytes(), StandardCharsets.UTF_8);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    @CrossOrigin
    @PostMapping(value = "/inspect/save_or_update")
    public Object save_or_update() {
        // 指定资源路径（相对于classpath根目录）
        try (InputStream inputStream = getClass().getClassLoader().getResourceAsStream("save_or_update.json")) {
            if (inputStream == null) {
                return "File not found.";
            }
            // 将输入流转换为字符串
            return new String(inputStream.readAllBytes(), StandardCharsets.UTF_8);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    @CrossOrigin
    @PostMapping(value = "/zp/inspect/save_or_update")
    public Object zp_save_or_update() {
        // 指定资源路径（相对于classpath根目录）
        try (InputStream inputStream = getClass().getClassLoader().getResourceAsStream("save_or_update.json")) {
            if (inputStream == null) {
                return "File not found.";
            }
            // 将输入流转换为字符串
            return new String(inputStream.readAllBytes(), StandardCharsets.UTF_8);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    @CrossOrigin
    @PostMapping(value = "/one_receipt_one_assess/report")
    public Object one_receipt_one_assess() {
        // 指定资源路径（相对于classpath根目录）
        try (InputStream inputStream = getClass().getClassLoader().getResourceAsStream("one_receipt_one_assess.json")) {
            if (inputStream == null) {
                return "File not found.";
            }
            // 将输入流转换为字符串
            return new String(inputStream.readAllBytes(), StandardCharsets.UTF_8);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    @CrossOrigin
    @PostMapping(value = "/inspect/get_inspect_notic_list")
    public Object get_inspect_notic_list() {
        // 指定资源路径（相对于classpath根目录）
        try (InputStream inputStream = getClass().getClassLoader().getResourceAsStream("get_inspect_notic_list2.json")) {
            if (inputStream == null) {
                return "File not found.";
            }
            // 将输入流转换为字符串
            return new String(inputStream.readAllBytes(), StandardCharsets.UTF_8);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }


    @CrossOrigin
    @PostMapping(value = "/auth/hasInspectViewRole")
    public Object hasInspectViewRole() {
        // 指定资源路径（相对于classpath根目录）
        try (InputStream inputStream = getClass().getClassLoader().getResourceAsStream("hasInspectViewRole.json")) {
            if (inputStream == null) {
                return "File not found.";
            }
            // 将输入流转换为字符串
            return new String(inputStream.readAllBytes(), StandardCharsets.UTF_8);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    @CrossOrigin
    @GetMapping(value = "/inspect/get_inspect_notice_info/{id}")
    public Object inspect_get_notice_info_id(@PathVariable String id) {
        // 指定资源路径（相对于classpath根目录）
        String fileName = "inspect_get_notice_info_id.json";
        try (InputStream inputStream = getClass().getClassLoader().getResourceAsStream(fileName)) {
            if (inputStream == null) {
                return "File not found.";
            }
            // 将输入流转换为字符串
            return new String(inputStream.readAllBytes(), StandardCharsets.UTF_8);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    @CrossOrigin
    @PostMapping(value = "/auth/get_real_wh_list_fty_no_user")
    public Object get_real_wh_list_fty_no_user() {
        // 指定资源路径（相对于classpath根目录）
        try (InputStream inputStream = getClass().getClassLoader().getResourceAsStream("get_real_wh_list_fty_no_user.json")) {
            if (inputStream == null) {
                return "File not found.";
            }
            // 将输入流转换为字符串
            return new String(inputStream.readAllBytes(), StandardCharsets.UTF_8);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}





